package com.tl.juc.threadPool;

public class UncaughtExceptionHandlerTest {

    public static void main(String[] args) {
        Thread thread = new Thread(() -> {

            System.out.println("执行任务");
            throw new RuntimeException("出现异常");
        });
        // 统一线程异常处理
        thread.setUncaughtExceptionHandler((t, e) -> {
            System.out.println("记录日志"+e.getMessage());
        });
        thread.start();



    }
}
